#include <stdio.h>
#include <fevent.h>
#include <string.h>

int do_accept(socket_ptr ptr, void* arg)
{
    printf("[tzj] [do_accept] ptr->fd: %d\n", ptr->fd);
    return 0;
}
int do_read(socket_ptr ptr, void* arg)
{
    printf("[tzj] [do_read] ptr->fd: %d, buffer: %s\n", ptr->fd, (char*)arg);
    return 0;
}

int main(int argc, const char* argv[])
{
    printf("[test_receiver] started!\n");

    fevent_config_t fevent_config;
    memset(&fevent_config, 0, sizeof(fevent_config_t));
    fevent_config.port = 9999;

    fevent_ptr fevent = fevent_malloc(&fevent_config);

    fevent->accept_func   = do_accept;
    fevent->read_func     = do_read;
    fevent->write_func    = NULL;

    fevent_loop(fevent);

    fevent_free(fevent);
    printf("[test_receiver] end!\n");
    return 0;
}
